package com.chaosj.tools.rules

import com.chaosj.tools.StockDiscoverTools

/**
 * 昨天 涨停,今天高开超过4个点
 */
class YesterdayMaxAndTodayUp implements IAbnormalRule{
    @Override
    boolean execute(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        for( int i = stocks.size()-1; i >= 0; i -- ){
            if( stocks.get(i-1).dailyLimit() && stocks.get(i).todayUp() > 1.04 ){
                println(description(stockName,(stocks.get(i).todayUp()*100-100)+""))
                return true
            }
            break
        }
        return false
    }

    @Override
    boolean support(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        return stocks.size()>=2
    }

    @Override
    String description(Object... desc) {
        return String.format("【%s】昨天涨停了,今天竞价大涨超过%s个点",desc)
    }
}
